import java.util.Arrays;

public class Solution26 {
    public int removeDuplicates(int[] nums) {
        int j=0,cur=Integer.MAX_VALUE;
        for (int i=0;i<nums.length;i++){
            if (nums[i]!=cur){
                nums[j]=nums[i];
                cur=nums[i];
                j++;
            }
        }
        return j;
    }

    public static void main(String[] args) {
        int[] f=new int[]{0,0,1,1,1,2,2,3,3,4};
        System.out.println(new Solution26().removeDuplicates(f));
        System.out.println(Arrays.toString(f));
    }
}
